#include <bits/stdc++.h>
#define SINGLE_INPUT
#define ll long long
#define ull unsigned long long
#define N 500005
#define MOD 998244353
using namespace std;
#define MAXN 300005
int st[MAXN][20]; // st[i][j] 代表区间[i, i+2^j)最小值
int st_g[MAXN][20]; // st_g[i][j] 代表区间[i, i+2^j)gcd
void ST(const vector<int>& a) {
int n = a.size();
for (int i = 0; i < n; i++)
st[i][0] = st_g[i][0] = a[i];
for (int j = 1; (1 << j) <= n; j++) { // 区间大小
for (int i = 0; i + (1 << j) - 1 < n; i++) { // 区间下限
st[i][j] = min(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]);
st_g[i][j] = __gcd(st_g[i][j - 1], st_g[i + (1 << (j - 1))][j - 1]);
}
}
}
bool ask(int l, int r) {
int k = 0;
while ((1 << (k + 1)) <= r - l + 1)
k++;
return min(st[l][k], st[r - (1 << k) + 1][k]) ==
__gcd(st_g[l][k], st_g[r - (1 << k) + 1][k]);
}
void sol() {
int n;
cin >> n;
vector<int> a(n);
for (int& i : a)
cin >> i;
ST(a);
int l = 1, r = n + 1;
while (l < r) {
int m = l + r >> 1;
int ok = 0;
for (int i = m - 1; i < n; i++) {
int j = i - m + 1; // [j, i]
if (ask(j, i)) {
ok = 1;
break;
}
}
if (ok) {
l = m + 1;
} else {
r = m;
}
}
int sz = r - 1;
vector<int> ans;
for (int i = sz - 1; i < n; i++) {
int j = i - sz + 1; // [j, i]
if (ask(j, i))
ans.push_back(j);
}
cout << ans.size() << " " << sz - 1 << "\n";
for (auto i : ans) {
cout << i + 1 << " ";
}
}
int main() {
cout << setprecision(15) << fixed;
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
#ifndef SINGLE_INPUT
int t;
cin >> t;
while (t--) {
sol();
}
#else
sol();
#endif
return 0;
}
1213A - Chips Moving | 490A - Team Olympiad |
233A - Perfect Permutation | 1360A - Minimal Square |
467A - George and Accommodation | 893C - Rumor |
227B - Effective Approach | 1534B - Histogram Ugliness |
1611B - Team Composition Programmers and Mathematicians | 110A - Nearly Lucky Number |
1220B - Multiplication Table | 1644A - Doors and Keys |
1644B - Anti-Fibonacci Permutation | 1610A - Anti Light's Cell Guessing |
349B - Color the Fence | 144A - Arrival of the General |
1106A - Lunar New Year and Cross Counting | 58A - Chat room |
230A - Dragons | 200B - Drinks |
13A - Numbers | 129A - Cookies |
1367B - Even Array | 136A - Presents |
1450A - Avoid Trygub | 327A - Flipping Game |
411A - Password Check | 1520C - Not Adjacent Matrix |
1538B - Friends and Candies | 580A - Kefa and First Steps |